<html>
<head>
<title>Create an empty DocumentFragment, append an iframe's contentWindow.document and see if it is accessible.</title>
<script type="text/javascript" src="/shared/scripts/testcase.js"></script>
<script type="text/javascript">
if (window.addEventListener) {
	window.addEventListener('load', f, false);
} else if (window.attachEvent) {
	window.attachEvent('onload', f);
} else {
	window.onload = f;
}

function f() {
	var tc = new TestCase();
	tc.input = 'var x = document.createDocumentFragment(); x.appendChild(cross_ifr....document);';
	tc.description = 'Create an empty DocumentFragment, append a remote iframe\'s document and see if it is accessible.';
	tc.expected_result = "exception occurred.";
	
	try {
		var ifr = document.getElementById('ifr_cross');
		var output = document.getElementById('output');
		var x = document.createDocumentFragment();
		var remote_doc = tc.getOriginDocument(ifr)
		x.appendChild(remote_doc);
		output.appendChild();
		tc.output += output.innerHTML;
		tc.result = 'possible to append remote DocumentFragment.';
		tc.test_passed = 'false';
	} catch(e) {
		// Should throw a WRONG_DOC exception
		tc.result = 'exception occurred';
		tc.output += 'exception occurred: ' + tc.outputException(e);
		tc.test_passed = 'true';
	}
	tc.saveTest();
}
</script>
</head>
<body>
<iframe src='http://victim.com/forbidden.html' id='ifr_cross'></iframe>
<div id='output'></div>
</body>
</html>